home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / MacWT 0.04 / wt / world.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-31  |  2.2 KB  |  73 lines  |  [TEXT/MMCC]

  1. /*
  2. **  wt -- a 3d game engine
  3. **
  4. **  Copyright (C) 1994 by Chris Laurel
  5. **  email:  claurel@mr.net
  6. **  snail mail:  Chris Laurel, 5700 W Lake St #208,  St. Louis Park, MN  55416
  7. **
  8. **  This program is free software; you can redistribute it and/or modify
  9. **  it under the terms of the GNU General Public License as published by
  10. **  the Free Software Foundation; either version 2 of the License, or
  11. **  (at your option) any later version.
  12. **
  13. **  This program is distributed in the hope that it will be useful,
  14. **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. **  GNU General Public License for more details.
  17. **
  18. **  You should have received a copy of the GNU General Public License
  19. **  along with this program; if not, write to the Free Software
  20. **  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22.  
  23. #define NO_WALL -1
  24.  
  25. typedef struct {
  26.      fixed x, y;
  27.      fixed tx, ty, proj;      /* transformed coordinates */
  28. } Vertex;
  29.  
  30.  
  31. typedef struct {
  32.      fixed floor, ceiling;
  33.      Texture *floor_tex, *ceiling_tex;
  34. } Region;
  35.  
  36.  
  37. typedef struct {
  38.      Vertex *vertex1, *vertex2;
  39.      Texture *surface_texture;
  40.      Region *front, *back;
  41.      fixed xphase, yphase;
  42.      fixed xscale, yscale;
  43.      Boolean sky;
  44.      Boolean opaque;
  45. } Wall;
  46.  
  47.  
  48. typedef struct {
  49.      Table *vertices;
  50.      Table *walls;
  51.      Table *regions;
  52.      Table *textures;
  53. } World;
  54.  
  55.  
  56. #define WORLD_VERTEX(w, v)   ((TABLE_ELEMENTS((w)->vertices, Vertex))[v])
  57. #define WORLD_TEXTURE(w, t)  ((TABLE_ELEMENTS((w)->textures, Texture *))[t])
  58. #define WORLD_REGION(w, r)   ((TABLE_ELEMENTS((w)->regions, Region))[r])
  59. #define WORLD_WALL(w, x)     ((TABLE_ELEMENTS((w)->walls, Wall))[x])
  60.  
  61. extern World *new_world(void);
  62. extern void add_texture(World *w, Texture *tex);
  63. extern void add_wall(World *w, Wall *wall);
  64. extern void add_vertex(World *w, Vertex *v);
  65. extern void add_region(World *w, Region *r);
  66. extern void update_wall_scale(World *w, int wall_num,
  67.                   fixed xscale, fixed yscale);
  68. extern void update_wall_phase(World *w, int wall_num,
  69.                   fixed xphase, fixed yphase);
  70. extern void update_wall_height(World *w, int wall_num,
  71.                    fixed floor_front, fixed floor_back,
  72.                    fixed ceiling_front, fixed ceiling_back);
  73.